package cn.enilu.guns.bean.dto;


import cn.enilu.guns.bean.entity.BaseEntity;
import cn.enilu.guns.bean.entity.door.EntranceGuardRule;
import cn.enilu.guns.bean.entity.door.EquipmentInfo;
import com.fasterxml.jackson.annotation.JsonBackReference;
import lombok.Data;
import org.hibernate.annotations.Table;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

@Data
public class DoorInfoDto extends BaseEntity {

	/**
	 * 
	 */
	private Integer version;

	/**
	 * 门名称
	 */
	private String doorName;

	/**
	 * 区域id
	 */
	private Long areaId;

	/**
	 * 门所属设备
	 */
//	private Long equipmentId;
	private EquipmentInfo equipmentInfo;

	/**
	 * 门磁类型
	 */
	private String doorType;

	/**
	 * 验证方式
	 */
	private String verificationMode;

	@ManyToMany(cascade = CascadeType.PERSIST,fetch = FetchType.LAZY)
	@JoinTable(name = "t_entrance_guard_door", joinColumns = @JoinColumn(name = "doorId", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "ruleId", referencedColumnName = "id"))
	@JsonBackReference
	private Set<EntranceGuardRule> entranceGuardRules = new HashSet<>();


}
